package com.example.autorefreshbussines.controller;

import com.example.autorefreshbussines.config.ConfigDemo;
import com.example.autorefreshbussines.service.ControllerDemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "自动刷新配置DEMO")
@RestController
@RequestMapping("autoRefresh")
public class ControllerDemo {
    @Autowired
    private ConfigDemo configDemo;
    @Autowired
    private ControllerDemoService controllerDemoService;

    @ApiOperation("获取当前配置")
    @PostMapping("getConfig")
    public String getConfig(){
        return String.format("当前配置：%s", configDemo.getTest());
    }

    @PostMapping("testDb")
    public String getConnectDataDb(){
        return controllerDemoService.testDb();
    }
}
